/**
 * 
 * @author Marina Polese
 *
 */

package capture;

import java.util.ArrayList;
import java.util.List;

import capture.analyzer.ARPAnalyzer;
import capture.analyzer.EthernetAnalyzer;
import capture.analyzer.FTPAnalyzer;
import capture.analyzer.HTTPAnalyzer;
import capture.analyzer.ICMPAnalyzer;
import capture.analyzer.IPv4Analyzer;
import capture.analyzer.IPv6Analyzer;
import capture.analyzer.AbstractPacketAnalyzer;
import capture.analyzer.POP3Analyzer;
import capture.analyzer.PacketAnalyzer;
import capture.analyzer.SMTPAnalyzer;
import capture.analyzer.SSHAnalyzer;
import capture.analyzer.TCPAnalyzer;
import capture.analyzer.TelnetAnalyzer;
import capture.analyzer.UDPAnalyzer;

public class PacketAnalyzerLoader {
	private static List<AbstractPacketAnalyzer> analyzers = new ArrayList<AbstractPacketAnalyzer>();
	private static List<List<AbstractPacketAnalyzer>> layerAnalyzers=new ArrayList<List<AbstractPacketAnalyzer>>();

	public static void loadDefaultAnalyzer(){
		analyzers.add(new PacketAnalyzer());
		analyzers.add(new EthernetAnalyzer());
		analyzers.add(new IPv4Analyzer());
		analyzers.add(new IPv6Analyzer());
		analyzers.add(new TCPAnalyzer());
		analyzers.add(new UDPAnalyzer());
		analyzers.add(new ICMPAnalyzer());
		analyzers.add(new HTTPAnalyzer());
		analyzers.add(new FTPAnalyzer());
		analyzers.add(new TelnetAnalyzer());
		analyzers.add(new SSHAnalyzer());
		analyzers.add(new SMTPAnalyzer());
		analyzers.add(new POP3Analyzer());
		analyzers.add(new ARPAnalyzer());

		for(int i=0;i<10;i++)
			layerAnalyzers.add(new ArrayList<AbstractPacketAnalyzer>());

		for(AbstractPacketAnalyzer a:analyzers)
			layerAnalyzers.get(a.layer).add(a);
	}

	public static List<AbstractPacketAnalyzer> getAnalyzers(){
		return analyzers;
	}

	public static List<AbstractPacketAnalyzer> getAnalyzersOf(int layer){
		return layerAnalyzers.get(layer);
	}
}
